﻿
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;

namespace Isuka.Linq
{
    partial class EnumerableExtensions
    {
        
		public static void BlockForEach<T>(this IEnumerable<T> collection, Action<T> action)
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
            
            BlockForEachIterator1(collection, action);
		}
		
        public static IEnumerable<R> BlockSelect<T, R>(this IEnumerable<T> collection, Func<T, R> selector)
        {
            Contract.Requires(collection != null);
            Contract.Requires(selector != null);
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
            
            return BlockSelectIterator1(collection, selector);
        }

        public static IEnumerable<Tuple<T>> BlockTie1<T>(this IEnumerable<T> collection)
        {
            Contract.Requires(collection != null);
            Contract.Ensures(Contract.Result<IEnumerable<Tuple<T>>>() != null);
            
            return BlockSelectIterator1(collection, Tuple.Create);
        }

        public static void BlockForEach1<T>(this IEnumerable<T> collection, Action<T> action)
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(action != null, "action");
            
			BlockForEachIterator1(collection, action);
		}

		static void BlockForEachIterator1<T>(this IEnumerable<T> collection, Action<T> action)
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    action(i1);
                }
            }
		}

        public static IEnumerable<R> BlockSelect1<T, R>(this IEnumerable<T> collection, Func<T, R> selector)
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(selector != null, "selector");
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
         
			return BlockSelectIterator1<T, R>(collection, selector);
        }

        static IEnumerable<R> BlockSelectIterator1<T, R>(IEnumerable<T> collection, Func<T, R> selector)
		{
            Contract.Requires(collection != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    yield return selector(i1);
                }
            }
		}
        
		public static void BlockForEach<T>(this IEnumerable<T> collection, Action<T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
            
            BlockForEachIterator2(collection, action, pad);
		}
		
        public static IEnumerable<R> BlockSelect<T, R>(this IEnumerable<T> collection, Func<T, T, R> selector, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Requires(selector != null);
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
            
            return BlockSelectIterator2(collection, selector, pad);
        }

        public static IEnumerable<Tuple<T, T>> BlockTie2<T>(this IEnumerable<T> collection, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Ensures(Contract.Result<IEnumerable<Tuple<T, T>>>() != null);
            
            return BlockSelectIterator2(collection, Tuple.Create, pad);
        }

        public static void BlockForEach2<T>(this IEnumerable<T> collection, Action<T, T> action, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(action != null, "action");
            
			BlockForEachIterator2(collection, action, pad);
		}

		static void BlockForEachIterator2<T>(this IEnumerable<T> collection, Action<T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    action(i1, i2);
                }
            }
		}

        public static IEnumerable<R> BlockSelect2<T, R>(this IEnumerable<T> collection, Func<T, T, R> selector, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(selector != null, "selector");
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
         
			return BlockSelectIterator2<T, R>(collection, selector, pad);
        }

        static IEnumerable<R> BlockSelectIterator2<T, R>(IEnumerable<T> collection, Func<T, T, R> selector, T pad = default(T))
		{
            Contract.Requires(collection != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    yield return selector(i1, i2);
                }
            }
		}
        
		public static void BlockForEach<T>(this IEnumerable<T> collection, Action<T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
            
            BlockForEachIterator3(collection, action, pad);
		}
		
        public static IEnumerable<R> BlockSelect<T, R>(this IEnumerable<T> collection, Func<T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Requires(selector != null);
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
            
            return BlockSelectIterator3(collection, selector, pad);
        }

        public static IEnumerable<Tuple<T, T, T>> BlockTie3<T>(this IEnumerable<T> collection, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Ensures(Contract.Result<IEnumerable<Tuple<T, T, T>>>() != null);
            
            return BlockSelectIterator3(collection, Tuple.Create, pad);
        }

        public static void BlockForEach3<T>(this IEnumerable<T> collection, Action<T, T, T> action, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(action != null, "action");
            
			BlockForEachIterator3(collection, action, pad);
		}

		static void BlockForEachIterator3<T>(this IEnumerable<T> collection, Action<T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    action(i1, i2, i3);
                }
            }
		}

        public static IEnumerable<R> BlockSelect3<T, R>(this IEnumerable<T> collection, Func<T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(selector != null, "selector");
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
         
			return BlockSelectIterator3<T, R>(collection, selector, pad);
        }

        static IEnumerable<R> BlockSelectIterator3<T, R>(IEnumerable<T> collection, Func<T, T, T, R> selector, T pad = default(T))
		{
            Contract.Requires(collection != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    yield return selector(i1, i2, i3);
                }
            }
		}
        
		public static void BlockForEach<T>(this IEnumerable<T> collection, Action<T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
            
            BlockForEachIterator4(collection, action, pad);
		}
		
        public static IEnumerable<R> BlockSelect<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Requires(selector != null);
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
            
            return BlockSelectIterator4(collection, selector, pad);
        }

        public static IEnumerable<Tuple<T, T, T, T>> BlockTie4<T>(this IEnumerable<T> collection, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Ensures(Contract.Result<IEnumerable<Tuple<T, T, T, T>>>() != null);
            
            return BlockSelectIterator4(collection, Tuple.Create, pad);
        }

        public static void BlockForEach4<T>(this IEnumerable<T> collection, Action<T, T, T, T> action, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(action != null, "action");
            
			BlockForEachIterator4(collection, action, pad);
		}

		static void BlockForEachIterator4<T>(this IEnumerable<T> collection, Action<T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    action(i1, i2, i3, i4);
                }
            }
		}

        public static IEnumerable<R> BlockSelect4<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(selector != null, "selector");
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
         
			return BlockSelectIterator4<T, R>(collection, selector, pad);
        }

        static IEnumerable<R> BlockSelectIterator4<T, R>(IEnumerable<T> collection, Func<T, T, T, T, R> selector, T pad = default(T))
		{
            Contract.Requires(collection != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    yield return selector(i1, i2, i3, i4);
                }
            }
		}
        
		public static void BlockForEach<T>(this IEnumerable<T> collection, Action<T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
            
            BlockForEachIterator5(collection, action, pad);
		}
		
        public static IEnumerable<R> BlockSelect<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Requires(selector != null);
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
            
            return BlockSelectIterator5(collection, selector, pad);
        }

        public static IEnumerable<Tuple<T, T, T, T, T>> BlockTie5<T>(this IEnumerable<T> collection, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Ensures(Contract.Result<IEnumerable<Tuple<T, T, T, T, T>>>() != null);
            
            return BlockSelectIterator5(collection, Tuple.Create, pad);
        }

        public static void BlockForEach5<T>(this IEnumerable<T> collection, Action<T, T, T, T, T> action, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(action != null, "action");
            
			BlockForEachIterator5(collection, action, pad);
		}

		static void BlockForEachIterator5<T>(this IEnumerable<T> collection, Action<T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    action(i1, i2, i3, i4, i5);
                }
            }
		}

        public static IEnumerable<R> BlockSelect5<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(selector != null, "selector");
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
         
			return BlockSelectIterator5<T, R>(collection, selector, pad);
        }

        static IEnumerable<R> BlockSelectIterator5<T, R>(IEnumerable<T> collection, Func<T, T, T, T, T, R> selector, T pad = default(T))
		{
            Contract.Requires(collection != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    yield return selector(i1, i2, i3, i4, i5);
                }
            }
		}
        
		public static void BlockForEach<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
            
            BlockForEachIterator6(collection, action, pad);
		}
		
        public static IEnumerable<R> BlockSelect<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Requires(selector != null);
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
            
            return BlockSelectIterator6(collection, selector, pad);
        }

        public static IEnumerable<Tuple<T, T, T, T, T, T>> BlockTie6<T>(this IEnumerable<T> collection, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Ensures(Contract.Result<IEnumerable<Tuple<T, T, T, T, T, T>>>() != null);
            
            return BlockSelectIterator6(collection, Tuple.Create, pad);
        }

        public static void BlockForEach6<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T> action, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(action != null, "action");
            
			BlockForEachIterator6(collection, action, pad);
		}

		static void BlockForEachIterator6<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    var i6 = e.MoveNext() ? e.Current : pad;
                    action(i1, i2, i3, i4, i5, i6);
                }
            }
		}

        public static IEnumerable<R> BlockSelect6<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(selector != null, "selector");
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
         
			return BlockSelectIterator6<T, R>(collection, selector, pad);
        }

        static IEnumerable<R> BlockSelectIterator6<T, R>(IEnumerable<T> collection, Func<T, T, T, T, T, T, R> selector, T pad = default(T))
		{
            Contract.Requires(collection != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    var i6 = e.MoveNext() ? e.Current : pad;
                    yield return selector(i1, i2, i3, i4, i5, i6);
                }
            }
		}
        
		public static void BlockForEach<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
            
            BlockForEachIterator7(collection, action, pad);
		}
		
        public static IEnumerable<R> BlockSelect<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Requires(selector != null);
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
            
            return BlockSelectIterator7(collection, selector, pad);
        }

        public static IEnumerable<Tuple<T, T, T, T, T, T, T>> BlockTie7<T>(this IEnumerable<T> collection, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Ensures(Contract.Result<IEnumerable<Tuple<T, T, T, T, T, T, T>>>() != null);
            
            return BlockSelectIterator7(collection, Tuple.Create, pad);
        }

        public static void BlockForEach7<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T> action, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(action != null, "action");
            
			BlockForEachIterator7(collection, action, pad);
		}

		static void BlockForEachIterator7<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    var i6 = e.MoveNext() ? e.Current : pad;
                    var i7 = e.MoveNext() ? e.Current : pad;
                    action(i1, i2, i3, i4, i5, i6, i7);
                }
            }
		}

        public static IEnumerable<R> BlockSelect7<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(selector != null, "selector");
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
         
			return BlockSelectIterator7<T, R>(collection, selector, pad);
        }

        static IEnumerable<R> BlockSelectIterator7<T, R>(IEnumerable<T> collection, Func<T, T, T, T, T, T, T, R> selector, T pad = default(T))
		{
            Contract.Requires(collection != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    var i6 = e.MoveNext() ? e.Current : pad;
                    var i7 = e.MoveNext() ? e.Current : pad;
                    yield return selector(i1, i2, i3, i4, i5, i6, i7);
                }
            }
		}
        
		public static void BlockForEach<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
            
            BlockForEachIterator8(collection, action, pad);
		}
		
        public static IEnumerable<R> BlockSelect<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Requires(selector != null);
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
            
            return BlockSelectIterator8(collection, selector, pad);
        }


        public static void BlockForEach8<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T, T> action, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(action != null, "action");
            
			BlockForEachIterator8(collection, action, pad);
		}

		static void BlockForEachIterator8<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    var i6 = e.MoveNext() ? e.Current : pad;
                    var i7 = e.MoveNext() ? e.Current : pad;
                    var i8 = e.MoveNext() ? e.Current : pad;
                    action(i1, i2, i3, i4, i5, i6, i7, i8);
                }
            }
		}

        public static IEnumerable<R> BlockSelect8<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(selector != null, "selector");
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
         
			return BlockSelectIterator8<T, R>(collection, selector, pad);
        }

        static IEnumerable<R> BlockSelectIterator8<T, R>(IEnumerable<T> collection, Func<T, T, T, T, T, T, T, T, R> selector, T pad = default(T))
		{
            Contract.Requires(collection != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    var i6 = e.MoveNext() ? e.Current : pad;
                    var i7 = e.MoveNext() ? e.Current : pad;
                    var i8 = e.MoveNext() ? e.Current : pad;
                    yield return selector(i1, i2, i3, i4, i5, i6, i7, i8);
                }
            }
		}
        
		public static void BlockForEach<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
            
            BlockForEachIterator9(collection, action, pad);
		}
		
        public static IEnumerable<R> BlockSelect<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Requires(selector != null);
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
            
            return BlockSelectIterator9(collection, selector, pad);
        }


        public static void BlockForEach9<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T, T, T> action, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(action != null, "action");
            
			BlockForEachIterator9(collection, action, pad);
		}

		static void BlockForEachIterator9<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    var i6 = e.MoveNext() ? e.Current : pad;
                    var i7 = e.MoveNext() ? e.Current : pad;
                    var i8 = e.MoveNext() ? e.Current : pad;
                    var i9 = e.MoveNext() ? e.Current : pad;
                    action(i1, i2, i3, i4, i5, i6, i7, i8, i9);
                }
            }
		}

        public static IEnumerable<R> BlockSelect9<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(selector != null, "selector");
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
         
			return BlockSelectIterator9<T, R>(collection, selector, pad);
        }

        static IEnumerable<R> BlockSelectIterator9<T, R>(IEnumerable<T> collection, Func<T, T, T, T, T, T, T, T, T, R> selector, T pad = default(T))
		{
            Contract.Requires(collection != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    var i6 = e.MoveNext() ? e.Current : pad;
                    var i7 = e.MoveNext() ? e.Current : pad;
                    var i8 = e.MoveNext() ? e.Current : pad;
                    var i9 = e.MoveNext() ? e.Current : pad;
                    yield return selector(i1, i2, i3, i4, i5, i6, i7, i8, i9);
                }
            }
		}
        
		public static void BlockForEach<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
            
            BlockForEachIterator10(collection, action, pad);
		}
		
        public static IEnumerable<R> BlockSelect<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires(collection != null);
            Contract.Requires(selector != null);
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
            
            return BlockSelectIterator10(collection, selector, pad);
        }


        public static void BlockForEach10<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T, T, T, T> action, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(action != null, "action");
            
			BlockForEachIterator10(collection, action, pad);
		}

		static void BlockForEachIterator10<T>(this IEnumerable<T> collection, Action<T, T, T, T, T, T, T, T, T, T> action, T pad = default(T))
		{
            Contract.Requires(collection != null);
            Contract.Requires(action != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    var i6 = e.MoveNext() ? e.Current : pad;
                    var i7 = e.MoveNext() ? e.Current : pad;
                    var i8 = e.MoveNext() ? e.Current : pad;
                    var i9 = e.MoveNext() ? e.Current : pad;
                    var i10 = e.MoveNext() ? e.Current : pad;
                    action(i1, i2, i3, i4, i5, i6, i7, i8, i9, i10);
                }
            }
		}

        public static IEnumerable<R> BlockSelect10<T, R>(this IEnumerable<T> collection, Func<T, T, T, T, T, T, T, T, T, T, R> selector, T pad = default(T))
        {
            Contract.Requires<ArgumentNullException>(collection != null, "collection");
            Contract.Requires<ArgumentNullException>(selector != null, "selector");
            Contract.Ensures(Contract.Result<IEnumerable<R>>() != null);
         
			return BlockSelectIterator10<T, R>(collection, selector, pad);
        }

        static IEnumerable<R> BlockSelectIterator10<T, R>(IEnumerable<T> collection, Func<T, T, T, T, T, T, T, T, T, T, R> selector, T pad = default(T))
		{
            Contract.Requires(collection != null);
			
            using (var e = collection.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    var i1 = e.Current;
                    var i2 = e.MoveNext() ? e.Current : pad;
                    var i3 = e.MoveNext() ? e.Current : pad;
                    var i4 = e.MoveNext() ? e.Current : pad;
                    var i5 = e.MoveNext() ? e.Current : pad;
                    var i6 = e.MoveNext() ? e.Current : pad;
                    var i7 = e.MoveNext() ? e.Current : pad;
                    var i8 = e.MoveNext() ? e.Current : pad;
                    var i9 = e.MoveNext() ? e.Current : pad;
                    var i10 = e.MoveNext() ? e.Current : pad;
                    yield return selector(i1, i2, i3, i4, i5, i6, i7, i8, i9, i10);
                }
            }
		}
    }
}
